package com.dt76.smallloanbackendservice.controller.xiaohao;

import com.dt76.smallloanbackendservice.pojo.xiaohao.BorrowOrder;
import com.dt76.smallloanbackendservice.pojo.xiaohao.BorrowOrderQuery;
import com.dt76.smallloanbackendservice.service.xiaohao.BorrowOrderService;
import com.dt76.smallloanbackendservice.utils.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/xiaohao")
public class BorrowOrderController {

    @Resource
    private BorrowOrderService borrowOrderService;

    @RequestMapping("/BorrowOrder/qryAllOrder")
    @ResponseBody
    public Page qryAllOrder(Integer currentPageNo) {
        return borrowOrderService.qryAllOrder(currentPageNo);
    }

    @PostMapping("/BorrowOrder/qryAllOrderByPage")
    @ResponseBody
    public Page qryAllOrderByPage(Integer currentPageNo, @RequestBody BorrowOrderQuery borrowOrderQuery) {
        System.out.println(borrowOrderQuery.toString());
        return borrowOrderService.qryAllOrderByPage(currentPageNo, borrowOrderQuery);
    }

    @RequestMapping("/BorrowOrder/qryByID")
    @ResponseBody
    public BorrowOrder qryByID(int id) {
        return borrowOrderService.qryByID(id);
    }

    @PostMapping("/BorrowOrder/qryAllContract")
    @ResponseBody
    public Page qryAllContract(Integer currentPageNo, @RequestBody BorrowOrderQuery borrowOrderQuery) {
        return borrowOrderService.qryAllContract(currentPageNo, borrowOrderQuery);
    }

    @PostMapping("/BorrowOrder/modifyBorrowOrderType")
    @ResponseBody
    public int modifyBorrowOrderType(@RequestBody BorrowOrder borrowOrder) {
        return borrowOrderService.modifyBorrowOrderType(borrowOrder);
    }

}
